package shuishijie.suishijie.model;



import android.os.Message;

import java.util.Date;

import shuishijie.suishijie.util.AppUtil;


/**
 * Created by mindx on 2017/8/29.
 */

public class JMessageInfo {
    public JMessageInfo() {
    }

    public JMessageInfo(Message msg) {
//        this.ctime_ms = AppUtil.dateTimeFormat(new Date(msg.getCreateTime()));
//        this.from_id = msg.getFromID();
//        this.target_id = msg.getTargetID();
//        this.from_platform = "app";
//        this.text = msg.getContentType() == ContentType.text ? ((TextContent) msg.getContent()).getText() : "";
//        this.media_url = msg.getContentType() == ContentType.image ? "file://"+((ImageContent) msg.getContent()).getLocalPath() : "";
//        this.msg_id = msg.getServerMessageId();
//        this.msg_status = 1;
//        this.msg_type = msg.getContentType().name();
    }

    /**
     * ctime_ms : 2017-10-14 12:02:17
     * from_id : shanyuwei
     * media_url : http://dl.im.jiguang.cn/qiniu/image/j/1276A58B0DEFB38E9B55BD8C11652F96.jpg?e=1507954636&token=yQc9oSkxEolUwU5r_59GkKwy41GiAEcP87D65TFQ:5J2Vg9FzNmWZkYRpYDxldAiMHV0=
     * msg_id : 450143394
     * msg_status : 1
     * msg_type : image
     * target_id : 15566833557
     */

    public String ctime_ms;
    public String from_id;
    public String media_url;
    public long msg_id;
    public int msg_status;
    public String msg_type;
    public String target_id;

    /**
     * from_platform : web
     * text : 请问有人在吗
     */

    public String from_platform;
    public String text;

    public long getCreateTime() {
        return AppUtil.parserDate(ctime_ms).getTime();
    }
}
